.TH std::begin(std::initializer_list) 3 "2024.06.10" "http://cppreference.com" "C++ Standard Libary"
.SH NAME
std::begin(std::initializer_list) \- std::begin(std::initializer_list)

.SH Synopsis
   Defined in header <initializer_list>
   template< class E >                                                \fI(since C++11)\fP
   const E* begin( std::initializer_list<E> il ) noexcept;            \fI(until C++14)\fP
   template< class E >                                                \fI(since C++14)\fP
   constexpr const E* begin( std::initializer_list<E> il ) noexcept;

   The overload of std::begin for initializer_list returns a pointer to the first
   element of il.

.SH Parameters

   il - an initializer_list

.SH Return value

   il.begin()

.SH Example


// Run this code

 #include <iostream>
 #include <iterator>
 #include <algorithm>
 #include <initializer_list>

 int main()
 {
     std::initializer_list il = {3, 1, 4, 1};

     std::copy(std::begin(il),
               std::end(il),
               std::ostream_iterator<int>(std::cout, "\\n"));
 }

.SH Output:

 3
 1
 4
 1

.SH See also

   begin returns a pointer to the first element
         \fI(public member function)\fP
